package org.argeproje.resim.ui.component.datasources;

import org.argeproje.resim.proc.view.ImgViewerPR;
import org.argeproje.resim.property.IntegerPRP;
import org.argeproje.resim.ui.model.ComponentItem;


public class ImageViewerCI extends ComponentItem{

	private static final long serialVersionUID = 1;
	
	private static final String IMG_WIDTH  = "Image.Width";	
	private static final String IMG_HEIGHT = "Image.Height";
	
	private int _imageWidth;
	private int _imageHeight;
	
	public ImageViewerCI()
	{		
		super();
		_name = "Image Viewer";
		_description = "Render an image";
		initProc();
	}		
		
	public Class<ImageViewerCI> getComponentClass() {
		return ImageViewerCI.class;
	}
	
	protected void initDescriptorList()
	{
		super.initDescriptorList();
		registerProperty(new IntegerPRP(this,
		         IMG_WIDTH,"Width","getImageWidth","setImageWidth"));
		registerProperty(new IntegerPRP(this,
		         IMG_HEIGHT,"Height","getImageHeight","setImageHeight"));

	}

	public int getImageWidth() {
		return _imageWidth;
	}

	public void setImageWidth(int imageWidth) {
		_imageWidth = imageWidth;
	}

	public int getImageHeight() {
		return _imageHeight;
	}

	public void setImageHeight(int imageHeight) {
		_imageHeight = imageHeight;
	}
	
	public void initProc() {
		if(_processor == null)
		{
			_processor = new ImgViewerPR();
		}	
	}
	
	public void updateProc() {
		if(_processor == null)
		{
			_processor = new ImgViewerPR();
		}	
	}
}
